package nl.avans.osgi.web.controllers;

import java.util.List;

import nl.avans.osgi.persistence.dm.person.data.PersonService;
import nl.avans.osgi.persistence.dm.person.model.Person;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


@Controller
@RequestMapping("/personResult.htm")
public class PersonDataController {

    @Autowired
    PersonService personService; 
    
    @RequestMapping(method = RequestMethod.GET)
    public String listPersons(ModelMap modelMap) {
        List<Person> employees = personService.getEmployees();
        modelMap.addAttribute(employees);
        return "listResults";
    }
}
